using Microsoft.VisualStudio.Modeling;

namespace Microsoft.Modeling.StoryboardDesigner
{
    partial class StoryboardElement
    {
        private bool CanMergeStoryboardElement(Microsoft.VisualStudio.Modeling.ProtoElementBase rootElement, Microsoft.VisualStudio.Modeling.ElementGroupPrototype elementGroupPrototype)
        {
            DomainClassInfo rootElementDomainInfo = this.Partition.DomainDataDirectory.GetDomainClass(rootElement.DomainClassId);

            // Can merge only if the root shape being merged is a StoryboardElement or
            // subtype AND if this current object is a StoryboardElement.
            // NB if the current object is derived from StoryboardElement, then
            // we don't allow the merge.
            bool canMerge = (rootElementDomainInfo.IsDerivedFrom(global::Microsoft.Modeling.StoryboardDesigner.StoryboardElement.DomainClassId)) &&
                (this.GetType() == typeof(StoryboardElement));

            return canMerge;
        }
    }
}